﻿using Sustainalytics.Entities;
using System;
using System.Collections.Generic;

namespace Sustainalytics.Claims.Service
{
    public class UIResourceDto
    {
        private UIResourceDto() { }

        public string Resource { get; set; }
        public string Verb { get; set; }
        public List<ResourceParameters> Parameters { get; set; }
        
        public static UIResourceDto Create(ResourceMap resource)
        {
            if (resource == null)
                throw new ArgumentException("Resource cannot be empty!");

            return new UIResourceDto
            {
                Resource = resource.Resource.Name,
                Verb = resource.Value,
                Parameters = resource.Parameters
            };
        }
    }
}
